<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文本</title>
<link th:href="@{/css/style.css}" rel="stylesheet" type="text/css" />
<script type="text/javascript" th:src="@{/js/jquery.js}"></script>
<script type="text/javascript">
function tipOpen(content,rkIndent) {
    $("#rkIndent").val(rkIndent);


	$(".tipright p").text(content);
	$("#tip").fadeIn(200);
}
function tipClose(num) {
  if(num==1){
    var indnet = $("#rkIndent").val();
    location.href="/erp/rkWarehouse/checkCgStatus?purchaseId="+indnet;
  }
	$("#tip").fadeOut(200);
}
</script>
</head>

<body>
<div class="place"> <span>位置：</span>
  <ul class="placeul">
    <li>仓库管理</li>
    <li>入库管理</li>
    <li>基本内容</li>
  </ul>
</div>
<div class="rightinfo">
  <form th:action="@{/rkWarehouse/lists}" method="post" name="conditionForm">
    <ul class="tools">
      <li>仓库名称:
        <input type="text" name="cName" th:value="${cName}"/>
      </li>
      <li>采购单编号:
        <input type="text" name="rkIndent" th:value="${rkIndent}"/>
      </li>
      <li>状态:
        <select name="state">
        	<option value="">请选择</option>
            <option value="1" th:selected="${state=='1'}">未入库</option>
            <option value="2" th:selected="${state=='2'}">已入库</option>
        </select>
      </li>
      <li class="subBut" onclick="query()"><img th:src="@{/images/t06.png}" />查询</li>
      <li class="subBut" onclick="window.location.href='/erp/rkWarehouse/toSaveRk'"><img th:src="@{/images/t01.png}" />添加入库</li>
    </ul>
    <table class="tablelist">
      <thead>
        <tr>
          <th>序号</th>
          <th>采购单编号</th>
          <th>金额</th>
          <th>仓库名称</th>
          <th>入库时间</th>
          <th>入库人</th>
          <th>状态</th>
          <th>操作</th>
        </tr>
      </thead>
      <tbody>
        <tr th:each="rk,var:${allRkPin.list}">
          <td th:text="${(allRkPin.pageNum-1)*allRkPin.pageSize+var.count}">1</td>
          <td th:text="${rk.rkIndent}">DJ201701270001</td>
          <td th:text="'￥'+${rk.cPurchase.totalMoney}">￥9,876,582</td>
          <td th:text="${rk.warehouse.cName}">南京21号仓库</td>
          <td th:text="${#dates.format(rk.rkDate,'yyyy-MM-dd HH:mm:ss')}">2013-09-09 15:05:05</td>
          <td th:text="${rk.rkUsers.uname}">朱元璋</td>
          <td th:text="${rk.state=='1'?'未入库':'已入库'}">未入库</td>
          <td>
          	<a th:href="@{/purchase/RkDetails?purchaseId=}+${rk.rkIndent}" class="tablelink">查看详情</a>
            <a href="javascript:void(0)" th:if="${rk.state=='1'}" class="tablelink" th:onclick="tipOpen('确定此采购单入库吗？',[[${rk.rkIndent}]])">入库</a>
            <a href="javascript:void(0)" th:if="${rk.state=='2'}" class="tablelink" th:onclick="tipOpen('确定此采购单取消入库吗？',[[${rk.rkIndent}]])">取消入库</a>
          </td>
        </tr>
      </tbody>
    </table>
    <div class="pagin">
      <div class="message">共<i class="blue" th:text="${allRkPin.total}">1256</i>条记录，当前显示第&nbsp;<i class="blue" th:text="${allRkPin.pageNum}">2&nbsp;</i>页</div>
      <ul class="paginList">
        <li class="paginItem" th:onclick="goPage([[${allRkPin.pageNum-1}]])"><a href="javascript:;"><span class="pagepre"></span></a></li>
        <li class="paginItem" th:onclick="goPage(1)" th:class="${allRkPin.pageNum==1?'paginItem current':'paginItem'}"><a href="javascript:;">1</a></li>

        <li th:each="p:${listPage}" th:class="${allRkPin.pageNum==p?'paginItem current':'paginItem'}" th:onclick="goPage([[${p}]])"><a th:text="${p}" href="javascript:;">2</a></li>

        <li class="paginItem" th:if="${allRkPin.pages!=1 and allRkPin.pages!=0}" th:onclick="goPage([[${allRkPin.pages}]])" th:class="${allRkPin.pageNum==allRkPin.pages?'paginItem current':'paginItem'}"><a href="javascript:;" th:text="${allRkPin.pages}" id="pages" >10</a></li>
        <li class="paginItem"  th:onclick="goPage([[${allRkPin.pageNum+1}]])"><a href="javascript:;"><span class="pagenxt"></span></a></li>
      </ul>
    </div>
  </form>
  <!-- 提示框 -->
  <div id="tip" class="tip">
    <div class="tiptop"><span>提示信息</span><a onclick="tipClose()"></a></div>
    <div class="tipinfo"> <span><img th:src="@{/images/ticon.png}" /></span>
      <div class="tipright">
        <p></p>
        <cite>如果是请点击确定按钮 ，否则请点取消。</cite> </div>
    </div>
    <div class="tipbtn">
      <input name="" type="button"  class="sure" value="确定" onclick="tipClose(1)" />
      &nbsp;
      <input name="" type="button"  class="cancel" value="取消" onclick="tipClose()" />
    </div>
    <input type="hidden" id="rkIndent">
  </div>
</div>
<script type="text/javascript">
  // 表单提交
  function query(){
    $("form[name='conditionForm']").submit();
  }


  // 页面跳转
  function goPage(num){
    var cName =  $("input[name=cName]").val();
    var rkIndent =  $("input[name=rkIndent]").val();
    var state  = $("select[name=state]").val();

    // 最后一页
    var pages = $("#pages").text();
    if(num>=1 && num<=pages){
      location.href="/erp/rkWarehouse/lists?pageno="+num+"&cName="+cName+"&rkIndent="+rkIndent+"&state="+state;
      //+"&cName="+cName+"&provinceId="+provinceId+"&cityId="+cityId
    }
  }
  
	$('.tablelist tbody tr:odd').addClass('odd');
</script>
</body>
</html>
